//
//  MessageViewCell.m
//  JZRJAPP
//
//  Created by mac on 16/5/18.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MessageViewCell.h"

@implementation MessageViewCell

-(void)setModel:(NewListModel *)model{
    _model = model;
   
    self.titleLabel.text = model.Title;
    
    self.goodLabel.text = model.Effect;
    if ([_goodLabel.text isEqualToString:@"一般利好"]) {
        _goodLabel.textColor = [UIColor redColor];
        _goodLabel.layer.borderColor = [UIColor redColor].CGColor;
         _goodLabel.text = @"利好";
    }
    if ([_goodLabel.text isEqualToString:@"一般利空"]) {
        _goodLabel.textColor = [UIColor greenColor];
        _goodLabel.layer.borderColor = [UIColor greenColor].CGColor;
        _goodLabel.text = @"利空";
        
    }
    if ([_goodLabel.text isEqualToString:@"中性"]) {
        _goodLabel.textColor = [UIColor yellowColor];
        _goodLabel.layer.borderColor = [UIColor yellowColor].CGColor;
        
    }
    
    NSString *timeStr = model.TimeStamp;
    NSTimeInterval time=[timeStr doubleValue]+28800;//因为时差问题要加8小时 == 28800 sec
    
    NSDate*detaildate=[NSDate dateWithTimeIntervalSince1970:time];
    
    NSLog(@"date:%@",[detaildate description]);
    
    //实例化一个NSDateFormatter对象
    
    NSDateFormatter*dateFormatter = [[NSDateFormatter alloc]init];
    
    //设定时间格式,这里可以设置成自己需要的格式
    
    [dateFormatter setDateFormat:@"MM-dd HH:mm"];
    
    NSString*currentDateStr = [dateFormatter stringFromDate:detaildate];
    
    self.dateLabel.text = currentDateStr;
    
}


@end
